import 'package:flutter/material.dart';
import 'package:shared_preferences/shared_preferences.dart';

class UserStore extends ChangeNotifier {
  bool isLogin = false;

  Future<void> setIsLogin(bool value) async {
    isLogin = value;
    notifyListeners();
    final SharedPreferences prefs = await SharedPreferences.getInstance();
    await prefs.setBool('isLogin', value);
  }

  Future<void> loadIsLogin() async {
    final SharedPreferences prefs = await SharedPreferences.getInstance();
    final bool? isLoginValue = prefs.getBool("isLogin");
    isLogin = isLoginValue ?? false;
    notifyListeners();
  }
}
